#include <iostream>


class Matrix{                           ///矩阵的类
 private:
  int row, col;                        ///变量行和列
  int [][];
 public:
  Matrix();
  Matrix(int r, int c);
  ~Matrix();
  Matrix operator * (const Matrix &x); ///矩阵乘法运算
  void Set_rowcol(int m,int n);        ///设置矩阵的行和列
  void SetMatrix();                   ///设置矩阵的元素
  void ShowMatrix();

};

bool Matrix::isSquare()const  ///判断是否为方阵
{
  if (row == col)
  {
    return true;
  }
  else
  {
    return false;
  }
}

#include <iostream>
using namespace std;

template <typename T>
class Matrix
{
 public:
  int n;
  int n_row, n_col;
  T**matrix_elements=NULL;

 public:
  bool is_square()
  {
    if (n_row == n_col)return true;
    else return false;
  }

  Matrix(T row,T col)
    {
      n_row=row;
      n_col=col;

      matrix_elements = new T*[row];
      for (int i=0;i<n_row;i++)
      {
	matrix_elements[i] = new T[n_col];
      }
    }
	
    ~Matrix()
    {
      for (int i=0; i<n_row; i++)
      {
	delate[] matrix_elements[i];
      }
      delete[] matrix_elements;
    }
    


    void print_matrix()
    {
	for (int j=0; j<n_col; j++)
        {
	  cout << matrix_elements[i][j] << "\t";
	}
	cout <<endl;
      }
    }


 int main()
 {

   int r,c;

   cout << "Enter the number of rows and columns:";
   cin >> r >> c;
   Matrix<int>M1(r,c),M2(r,c),M(r,c);
   if (M1.is_square()==true
   {
     cout << "It is a square matrix" << endl;
   }
     else cout << "It is not a square matrix" << endl;
     cout << "Start input Matrix1:";
     for (int i = 0; i<M1.n_row;i++)
     {
       for(int j = 0;M1.n_col;j++;
       {
	 cin >> M1.matrixs_elements[i][j];
       }
     }
     M1.print_matrix();

Matrix Matrix::operator*(const Matrix &x)         ///矩阵间乘法的运算
{
    Matrix temp(row, x.col);
    for (int i=0; i<row; i++)
    {
      for (int j=0; j < col; j++)
	{
	  for (int k=0; k<row; k++)
	    temp.pt[i][j] +=pt[i][k] * x.pt[k][j];
	}
    }
    return temp;
}
       
    
    

  

